package com.z.blog.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.z.base.vo.PageVo;
import com.z.blog.entity.Type;
import com.z.blog.mapper.TypeMapper;
import com.z.blog.service.ITypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 * 博客类型Service业务层处理
 *
 * @author z
 * @date 2022-09-09
 */
@Service
public class TypeServiceImpl extends ServiceImpl<TypeMapper,Type> implements ITypeService {

    @Autowired
    private TypeMapper typeMapper;
    @Override
    public List<Type> listTypeTop(int top) {
        PageHelper.startPage(1, top);
        return typeMapper.listTypeTop();
    }
    /**
     * 查询博客类型
     * @param type 博客类型
     * @param pageVo
     * @return 博客类型 分页集合
     * */
    @Override
    public PageInfo<Type> selectTypePage(Type type, PageVo pageVo) {
        PageHelper.startPage(pageVo.getPage(), pageVo.getLimit());
        List<Type> data = baseMapper.selectTypeList(type);
        return new PageInfo<>(data);
    }


}
